<?php

namespace app\validate;

use think\Validate;

class Certificate extends Validate
{
    /**
     * 证书管理&业务管理验证器
     */

    protected $rule = [
//        'certificate_name'=>['require'],//证书称呼
//        'person_id_card|身份证' =>['require','idCard'],//证书类别
//        'parent_id'=>['require'],//父类id
    ];

    protected $message = [
        'certificate_name.require'=>'证书类型不能为空',
        'certificate_type.require'=>'证书类别不能为空',
        'parent_id.require'=>'父类id不能为空',
        'is_k.require'=>'必须选择开关操作'
    ];

    public function sceneEdit()
    {
        return $this->only(['id','certificate_name'])
            ->append('id','require')
            ->append('certificate_name','require');
    }

    public function sceneIsDe()
    {
        return $this->only(['id','is_k'])
            ->append('id','require')
            ->append('is_k','require');
    }

    public function sceneAddCertificateRegister()
    {
        return $this->only([
            'business_id',
            'certificate_id',
            'person_name',
            'social_security',
            'social_security_acc_status',
            'certificate_b',
            'b_doc_status',
            'project',
            'cycle',
            'acquisition_date',
            'contract_price',
            'catual_price',
            'person_id_card',
            'responsibility_uid'
        ])
            ->append('business_id|业务类型','require')
            ->append('certificate_id|证书信息','require')
            ->append('person_name|人才姓名','require')
            ->append('social_security|社保','require')
            ->append('social_security_acc_status|社保账户','require')
            ->append('certificate_b|B证','require')
            ->append('b_doc_status|B证是否调入','require')
            ->append('project|项目','require')
            ->append('cycle|周期','require')
            ->append('acquisition_date|收证时间','require')
            ->append('contract_price|合同价格','require')
            ->append('catual_price|实际收证价','require')
            ->append('person_id_card|身份证号码','require|idCard')
            ->append('responsibility_uid|审核人','require');
    }

    public function sceneFile()
    {
//        return $this->only(['information_file','contract_file'])
//            ->append('information_file|资料文件','require|fileSize:4194304')
//            ->append('contract_file|合同文件','require|fileSize:4194304');
//        return $this->only(['information_file'])
//            ->append('information_file|资料文件','require|fileSize:4194304');
    }
    //人才库  证书办理
    public function sceneHandleCertificate()
    {

        return $this->only([
//            'business_id',
//            'sale_date',
//            'person_name',
//            'person_id_card',
//            'certificate_id',
//            'cost_price',
//            'sale_price',
//            'notes',
//            'file_illustrate',
//            'contract_illustrate',
            'responsibility_uid'
        ])
//            ->append('business_id|业务类型','require')
//            ->append('sale_date|销售日期','require')
//            ->append('person_name|人才姓名','require')
//            ->append('person_id_card|身份证','require')
//            ->append('certificate_id|证书专业','require')
//            ->append('cost_price|成本价格','require')
//            ->append('sale_price|销售价格','require')
//            ->append('notes|备注','require')
//            ->append('file_illustrate|文件说明','require')
//            ->append('contract_illustrate|合同说明','require')
            ->append('responsibility_uid|负责人id','require')
            ->append('responsibility_uid|负责人id','number');

    }

    //人才库  企业证书业务
    public function sceneEnterpriseCert()
    {

        return $this->only([
//            'business_id',
//            'business_text',
//            'sale_date',
//            'get_organization_id',
//            'get_uid',
//            'push_organization_id',
//            'push_uid',
//            'enterprise_id',
//            'contacts',
//            'notes',
//            'file_illustrate',
            'responsibility_uid'
        ])
//            ->append('business_id|业务类型','require')
//            ->append('business_text|业务内容','require')
//            ->append('sale_date|销售日期','require')
//            ->append('get_organization_id|收证部门','require')
//            ->append('get_uid|收证人','require')
//            ->append('push_organization_id|出证部门','require')
//            ->append('push_uid|出证人','require')
//            ->append('enterprise_id|企业名称id','require')
//            ->append('contacts|联系人','require')
//            ->append('notes|备注','require')
//            ->append('file_illustrate|文件说明','require')
            ->append('responsibility_uid|负责人id','number')

            ->append('responsibility_uid|负责人id','require');
    }

    //企业库 注册证书
    public function sceneAddEnRegCertificate()
    {
        return $this->only([
            'type',
            'sale_org',
            'sale_uid',
            'reg_unit',
            'price_unit',
            'certificate_id',
            'certificate_b',
            'social_security',
            'cycle',
            'project',
            'people_num'
        ])->append('type|公示栏、资料部','require')
            ->append('sale_org|销售部门','require')
            ->append('sale_uid|销售人员','require')
            ->append('reg_unit|注册单位','require')
            ->append('price_unit|单位价','require')
            ->append('certificate_id|证书专业id','require')
            ->append('certificate_b|B证','require')
            ->append('social_security|社保','require')
            ->append('cycle|周期','require')
            ->append('project|项目','require')
            ->append('people_num|人数','require');

    }

    //企业库 倒证
    public function sceneExchangeCertificate()
    {
        return $this->only([
            'employ_unit_title',
            'employ_unit_type',
            'employ_unit_name',
            'employ_unit_mobile',
            'unit_reg_title',
            'out_org',
            'out_uid',
            'out_price',
            'get_price',
            'notice_id',
        ])->append('employ_unit_title|聘用单位','require')
            ->append('employ_unit_type|企业来源','require')
            ->append('employ_unit_name|单位联系人','require')
            ->append('employ_unit_mobile|联系方式','require')
            ->append('unit_reg_title|注册单位','require')
            ->append('out_org|出证部门','require')
            ->append('out_uid|出证人','require')
            ->append('out_price|出证价','require')
            ->append('get_price|收证价','require')
            ->append('notice_id|通知人员','require');
    }

    //倒证第二步
    public function sceneEditExchangeCertificate()
    {
        return $this->only([
            'out_unit',
            'out_name',
            'out_mobile',
            'certificate_id',
            'person_name',
//            'reg_become_date',
            'id_card',
            'info_generate_mobile'


        ])->append('out_unit|供证单位','require')
            ->append('out_name|供证单位联系人','require')
            ->append('out_mobile|供证单位联系电话','require')
            ->append('certificate_id|证书信息','require')
            ->append('person_name|人才姓名','require')
//            ->append('reg_become_date|注册到期时间','require')
            ->append('id_card|身份证号码','require|idCard')
            ->append('info_generate_mobile|信息生成联系电话','requireWith:info_generate_mobile|mobile');

    }

    //企业库 倒证编辑
//    public function sceneEditExchangeCertificate()
//    {
//        return $this->only([
//            'employ_unit_title',
//            'employ_unit_type',
//            'employ_unit_name',
//            'employ_unit_mobile',
//            'unit_reg_title',
//            'out_org',
//            'out_uid',
//            'out_price',
//            'get_price',
////            'notice_id',
//            'certificate_id',
//            'certificate_b',
//            'social_security',
//            'cycle',
//            'project',
//            'transfer',
//            'get_org',
//            'get_uid',
//            'person_name',
//            'id_card',
//            'performance'
//
//        ])->append('employ_unit_title|聘用单位','require')
//            ->append('employ_unit_type|企业来源','require')
//            ->append('employ_unit_name|单位联系人','require')
//            ->append('employ_unit_mobile|联系方式','require')
//            ->append('unit_reg_title|注册单位','require')
//            ->append('out_org|出证部门','require')
//            ->append('out_uid|出证人','require')
//            ->append('out_price|出证价','require')
//            ->append('get_price|收证价','require')
//            ->append('certificate_id|证书信息','require')
//            ->append('certificate_b|B证','require')
//            ->append('social_security|社保','require')
//            ->append('cycle|周期','require')
//            ->append('project|项目','require')
//            ->append('transfer|是否中转','require')
//            ->append('get_org|收证部门','require')
//            ->append('get_uid|收证人','require')
//            ->append('person_name|人才姓名','require')
//            ->append('id_card|身份证号','require')
//            ->append('performance|业绩','require');
//    }


    //公示栏 新建人才(外部证书注册)
    public function scenePublicAddPerson()
    {
        return $this->only([
//            'certificate_code',
//            'submit_uid',
            'certificate_id',
//            'social_security',
//            'certificate_b',
//            'project',
//            'cycle',
//            'transfer',
//            'acquisition_date',
//            'contract_price',
        ])
//            ->append('certificate_code|证书编号','require')
//            ->append('submit_uid|提交人','require')
            ->append('certificate_id|证书专业id','require');
//            ->append('social_security|社保','require')
//            ->append('certificate_b|B证','require')
//            ->append('project|项目','require')
//            ->append('cycle|周期','require')
//            ->append('transfer|是否中转','require')
//            ->append('acquisition_date|收证时间','require|date')
//            ->append('contract_price|收证价','require');
    }

    //公示栏新建企业
    public function scenePublicAddEnter()
    {
        return $this->only([
            'type',
            'sale_org',
            'sale_uid',
            'reg_unit',
        ])->append('type|公示栏、资料部','require')
            ->append('sale_org|销售部门','require')
            ->append('sale_uid|销售人员','require')
            ->append('reg_unit|注册单位','require');
    }


}